﻿/// <reference path="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2-vsdoc.js" /> 
var Tapt = {};

$(document).ready(function () {
    //active link
    $("[data-navlinkname='" + activeTopTab + "']").css("background-color", "rgba(0,0,0,0.8)").attr("data-active", "true");

    // Home Link
    $("#homeLink, #SideTopHomeLink").click(function () {
        window.location.href = "/";
    });

    $(".siteNavItem").mouseenter(function () {
        if (!$(this).attr("data-active")) { $(this).css("background-color", "rgba(0,0,0,0.8)") }
    }).mouseleave(function () {
        if (!$(this).attr("data-active")) { $(this).css("background-color", "rgba(0,0,0,0.6)") }
    }).click(function (e) {
        window.location.href = $(this).find(".siteNavLink").attr("href");
    });
});

Tapt.DoAjaxPro = function (data, methodName, callback)
{
    $("#ajaxCover").show();
    $.ajax({
        type: "POST",
        url: Tapt.ajaxProPath,     // this is the path from above
        data: data,
        beforeSend: function (xhr) {
            xhr.setRequestHeader("X-AjaxPro-Method", methodName);
        },
        success: function (res) {
            callback(res);
            $("#ajaxCover").hide();
        },
        error: function(error) {
            console.log(error);
            $("#ajaxCover").hide();
        }
    });
    
}
